import request from '@/utils/request'
import { param } from '../../../utils'

class DistributionApi {
  query(data) {
    return request({
      url: '/distributionmain/list',
      method: 'get',
      data
    })
  }
  queryByCond(data, pageSize, pageNum) {
    return request({
      url: `/distributionmain/queryByCond?pageSize=${pageSize}&pageNum=${pageNum}`,
      method: 'post',
      data
    })
  }
  add(data) {
    return request({
      url: '/distribution/createDistribution',
      method: 'post',
      data
    })
  }
  importExcelData(data) {
    return request({
      url: '/distribution/importExcelData',
      method: 'post',
      data
    })
  }
  update(data) {
    return request({
      url: '/distribution/update',
      method: 'post',
      data
    })
  }
  delete(data) {
    return request({
      url: '/distributionmain/delete',
      method: 'post',
      data
    })
  }
  //
  getSubDepartmentsWithUsers(data) {
    return request({
      url: '/api/dept-user-tree/getSubDepartmentsWithUsers',
      method: 'get',
      params:data
    })
  }
  getDistributionTree(data) {
    return request({
      url: '/distribution/getDistributionTree',
      method: 'get',
      params:data
    })
  }
  getChdistribution(data) {
    return request({
      url: '/chdistribution/special',
      method: 'get',
      params:data
    })
  }
  updateDistribution(data) {
    return request({
      url: '/distribution/updateDistribution',
      method: 'post',
      data
    })
  }
  getSelUpdateDto(data) {
    return request({
      url: '/distributiontree/selUpdateDto',
      method: 'get',
      params:data
    })
  }
  downloadFile(data) {
    return request({
      url: `/minio-proxy/distribution/${data}`,
      method: 'get',
      responseType: 'blob',
    })
  }
  getPeerAndSubDeptsWithUsers() {
    return request({
      url: '/api/dept-user-tree/getPeerAndSubDeptsWithUsers',
      method: 'get',
    })
  }
  ///api/dept-user-tree/getPeerAndSubDeptsWithUsers
  ///distribution/getDistributionTree
  getDistributionTree(data) {
    return request({
      url: '/distribution/getDistributionTree',
      method: 'get',
      params:data
    })
  }
  ///distribution/receiveFile
  receiveFile(data) {
    return request({
      url: '/distribution/receiveFile',
      method: 'post',
      data
    })
  }
  ///distribution/getDistributionDetail
  getDistributionDetail(data) {
    return request({
      url: '/distribution/getDistributionDetail',
      method: 'get',
      params:data
    })
  }
  destroyFile(data) {
    return request({
      url: '/distribution/destroyFile',
      method: 'post',
      data:data
    })
  }
  exportDistribution(data) {
    return request({
      url: '/exportDistributionStats',
      method: 'get',
      params:data,
      responseType: 'blob',
    })
  }
  ///exportDistributionStats
  ///distribution/destroyFile
}

export default new DistributionApi()
